/* my define */
#if !defined SBITARRAY
#define SBITARRAY
/* define for c */
#define true 1
#define false 0
#define bool unsigned char
/* define shortcuts for port */
#define _def(id,n) sbit p_##id_##n=P##id^n //;P_##id_##n=0
#define _get(id,n) p_##id_##n
#define _set(id,n,val) p_##id_##n=##val

/* help sleep function */
void sleep(float n ) {int x=n*10000;while(--x);}

/* main function def */
#define _begin void main(){
#define _forever for(;;){
#define _end }

/* array function define !! */
//define _array0
#if defined _num0
#if _num0==1
_def(0,0);
#endif

#if _num0==2
_def(0,0);
_def(0,1);
#endif

#if _num0==3
_def(0,0);
_def(0,1);
_def(0,2);
#endif

#if _num0==4
_def(0,0);
_def(0,1);
_def(0,2);
_def(0,3);
#endif

#if _num0==5
_def(0,0);
_def(0,1);
_def(0,2);
_def(0,3);
_def(0,4);
#endif

#if _num0==6
_def(0,0);
_def(0,1);
_def(0,2);
_def(0,3);
_def(0,4);
_def(0,5);
#endif

#if _num0==7
_def(0,0);
_def(0,1);
_def(0,2);
_def(0,3);
_def(0,4);
_def(0,5);
_def(0,6);
#endif
#if _num0==8
_def(0,0);
_def(0,1);
_def(0,2);
_def(0,3);
_def(0,4);
_def(0,5);
_def(0,6);
_def(0,7);
#endif
//--------------end 


void array0(int port,int val){
	switch(port){
	  #if _num0==1
	  case 0:_set(0,0,val);break;
	  #endif
	  #if _num0==2
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  #endif
	  #if _num0==3
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  #endif
	  #if _num0==4
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  case 3:_set(0,3,val);break;
	  #endif
	  #if _num0==5
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  case 3:_set(0,3,val);break;
	  #endif
	  #if _num0==6
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  case 3:_set(0,3,val);break;
	  case 4:_set(0,4,val);break;
	  case 5:_set(0,5,val);break;
	  #endif
	  #if _num0==7
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  case 3:_set(0,3,val);break;
	  case 4:_set(0,4,val);break;
	  case 5:_set(0,5,val);break;
	  case 6:_set(0,6,val);break;
	  #endif
	  #if _num0==8
	  case 0:_set(0,0,val);break;
	  case 1:_set(0,1,val);break;
	  case 2:_set(0,2,val);break;
	  case 3:_set(0,3,val);break;
	  case 4:_set(0,4,val);break;
	  case 5:_set(0,5,val);break;
	  case 6:_set(0,6,val);break;
	  case 7:_set(0,6,val);break;
	  #endif
	  default:break;
	}
}//end _array0
#endif  //end _array0

//define _array1
#if defined _num1
#if _num1==1
_def(1,0);
#endif

#if _num1==2
_def(1,0);
_def(1,1);
#endif

#if _num1==3
_def(1,0);
_def(1,1);
_def(1,2);
#endif

#if _num1==4
_def(1,0);
_def(1,1);
_def(1,2);
_def(1,3);
#endif

#if _num1==5
_def(1,0);
_def(1,1);
_def(1,2);
_def(1,3);
_def(1,4);
#endif

#if _num1==6
_def(1,0);
_def(1,1);
_def(1,2);
_def(1,3);
_def(1,4);
_def(1,5);
#endif

#if _num1==7
_def(1,0);
_def(1,1);
_def(1,2);
_def(1,3);
_def(1,4);
_def(1,5);
_def(1,6);
#endif
#if _num1==8
_def(1,0);
_def(1,1);
_def(1,2);
_def(1,3);
_def(1,4);
_def(1,5);
_def(1,6);
_def(1,7);
#endif
//--------------end 


void array1(int port,int val){
	switch(port){
	  #if _num1==1
	  case 0:_set(1,0,val);break;
	  #endif
	  #if _num1==2
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  #endif
	  #if _num1==3
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  #endif
	  #if _num1==4
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  case 3:_set(1,3,val);break;
	  #endif
	  #if _num1==5
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  case 3:_set(1,3,val);break;
	  #endif
	  #if _num1==6
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  case 3:_set(1,3,val);break;
	  case 4:_set(1,4,val);break;
	  case 5:_set(1,5,val);break;
	  #endif
	  #if _num1==7
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  case 3:_set(1,3,val);break;
	  case 4:_set(1,4,val);break;
	  case 5:_set(1,5,val);break;
	  case 6:_set(1,6,val);break;
	  #endif
	  #if _num1==8
	  case 0:_set(1,0,val);break;
	  case 1:_set(1,1,val);break;
	  case 2:_set(1,2,val);break;
	  case 3:_set(1,3,val);break;
	  case 4:_set(1,4,val);break;
	  case 5:_set(1,5,val);break;
	  case 6:_set(1,6,val);break;
	  case 7:_set(1,7,val);break;
	  #endif
	  default:break;
	}
}//end _array1
#endif  //end _array1

//define _array2
#if defined _num2
#if _num2==1
_def(2,0);
#endif

#if _num2==2
_def(2,0);
_def(2,1);
#endif

#if _num2==3
_def(2,0);
_def(2,1);
_def(2,2);
#endif

#if _num2==4
_def(2,0);
_def(2,1);
_def(2,2);
_def(2,3);
#endif

#if _num2==5
_def(2,0);
_def(2,1);
_def(2,2);
_def(2,3);
_def(2,4);
#endif

#if _num2==6
_def(2,0);
_def(2,1);
_def(2,2);
_def(2,3);
_def(2,4);
_def(2,5);
#endif

#if _num2==7
_def(2,0);
_def(2,1);
_def(2,2);
_def(2,3);
_def(2,4);
_def(2,5);
_def(2,6);
#endif
#if _num2==8
_def(2,0);
_def(2,1);
_def(2,2);
_def(2,3);
_def(2,4);
_def(2,5);
_def(2,6);
_def(2,7);
#endif
//--------------end 


void array2(int port,int val){
	switch(port){
	  #if _num2==1
	  case 0:_set(2,0,val);break;
	  #endif
	  #if _num2==2
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  #endif
	  #if _num2==3
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  #endif
	  #if _num2==4
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  case 3:_set(2,3,val);break;
	  #endif
	  #if _num2==5
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  case 3:_set(2,3,val);break;
	  #endif
	  #if _num2==6
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  case 3:_set(2,3,val);break;
	  case 4:_set(2,4,val);break;
	  case 5:_set(2,5,val);break;
	  #endif
	  #if _num2==7
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  case 3:_set(2,3,val);break;
	  case 4:_set(2,4,val);break;
	  case 5:_set(2,5,val);break;
	  case 6:_set(2,6,val);break;
	  #endif
	  #if _num2==8
	  case 0:_set(2,0,val);break;
	  case 1:_set(2,1,val);break;
	  case 2:_set(2,2,val);break;
	  case 3:_set(2,3,val);break;
	  case 4:_set(2,4,val);break;
	  case 5:_set(2,5,val);break;
	  case 6:_set(2,6,val);break;
	  case 7:_set(2,7,val);break;
	  #endif
	  default:break;
	}
}//end _array2
#endif  //end _array2


//define _array3
#if defined _num3
#if _num3==1
_def(3,0);
#endif

#if _num3==2
_def(3,0);
_def(3,1);
#endif

#if _num3==3
_def(3,0);
_def(3,1);
_def(3,2);
#endif

#if _num3==4
_def(3,0);
_def(3,1);
_def(3,2);
_def(3,3);
#endif

#if _num3==5
_def(3,0);
_def(3,1);
_def(3,2);
_def(3,3);
_def(3,4);
#endif

#if _num3==6
_def(3,0);
_def(3,1);
_def(3,2);
_def(3,3);
_def(3,4);
_def(3,5);
#endif

#if _num3==7
_def(3,0);
_def(3,1);
_def(3,2);
_def(3,3);
_def(3,4);
_def(3,5);
_def(3,6);
#endif

#if _num3==8
_def(3,0);
_def(3,1);
_def(3,2);
_def(3,3);
_def(3,4);
_def(3,5);
_def(3,6);
_def(3,7);
#endif
//--------------end 


void array3(int port,int val){
	switch(port){
	  #if _num3==1
	  case 0:_set(3,0,val);break;
	  #endif
	  #if _num3==2
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  #endif
	  #if _num3==3
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  #endif
	  #if _num3==4
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  case 3:_set(3,3,val);break;
	  #endif
	  #if _num3==5
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  case 3:_set(3,3,val);break;
	  #endif
	  #if _num3==6
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  case 3:_set(3,3,val);break;
	  case 4:_set(3,4,val);break;
	  case 5:_set(3,5,val);break;
	  #endif
	  #if _num3==7
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  case 3:_set(3,3,val);break;
	  case 4:_set(3,4,val);break;
	  case 5:_set(3,5,val);break;
	  case 6:_set(3,6,val);break;
	  #endif
	  #if _num3==8
	  case 0:_set(3,0,val);break;
	  case 1:_set(3,1,val);break;
	  case 2:_set(3,2,val);break;
	  case 3:_set(3,3,val);break;
	  case 4:_set(3,4,val);break;
	  case 5:_set(3,5,val);break;
	  case 6:_set(3,6,val);break;
	  case 7:_set(3,7,val);break;
	  #endif
	  default:break;
	}
}//end _array3
#endif  //end _array3


#endif //end SBITARRAY
